package com.laiyao.bean;

import com.spring.AOP.AopAnnotation.Aspect;
import com.spring.AOP.AopAnnotation.Around;
import com.spring.AOP.AopInterface.ProceedJoinPoint;
import com.spring.Transaction.TransactionInterceptor;
import com.spring.springAnnotation.Autowired;
@Aspect
public class TransactionAspect {

    private TransactionInterceptor transactionInterceptor=new TransactionInterceptor();

    @Around("@annotation(com.spring.Transaction.Transactional)") // 切入点表达式：匹配有@Transactional的方法
    public Object around(ProceedJoinPoint joinPoint) throws Throwable {
        return transactionInterceptor.invoke(joinPoint);
    }
}